package com.itheima07;

/*
 * Lambda 表达式和匿名内部类的区别
 * */
public class LambdaDemo {
    public static void main(String[] args) {
        // 匿名内部类
        /*
        useInter(new Inter() {
            @Override
            public void show() {
                System.out.println("接口");
            }
        });

        useAnimal(new Animal() {
            @Override
            public void method1() {
                System.out.println("抽象类");
            }
        });

        useStudent(new Student() {
            @Override
            public void study() {
                System.out.println("具体类");
            }
        });
        */

        // Lambda 表达式
        useInter(() -> System.out.println("接口"));
//        useAnimal(()-> System.out.println("抽象类"));
//        useStudent(() -> System.out.println("具体类"));
    }

    public static void useStudent(Student s) {
        s.study();
    }

    public static void useAnimal(Animal a) {
        a.method1();
    }

    public static void useInter(Inter i) {
        i.show();
    }
}
